import 'package:audio_session/audio_session.dart' as audio_session;

import '../bean.dart';

/// An event capturing the addition or removal of connected devices.
class AudioDevicesChangedEvent {
  /// The audio devices just made available.
  final Set<AudioDevice> devicesAdded;

  /// The audio devices just made unavailable.
  final Set<AudioDevice> devicesRemoved;

  AudioDevicesChangedEvent({
    this.devicesAdded = const {},
    this.devicesRemoved = const {},
  });

  AudioDevicesChangedEvent.from(audio_session.AudioDevicesChangedEvent event):
  devicesAdded = event.devicesAdded.map((e) => AudioDevice.from(e)).toSet(),
  devicesRemoved = event.devicesRemoved.map((e) => AudioDevice.from(e)).toSet()
  ;
}